home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Tools / Win95 Secrets / SETUP.Z / W32INFO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-19  |  5.8 KB  |  195 lines

  1. //==================================
  2. // W32SVSPY - Matt Pietrek 1995
  3. // FILE: W32INFO.C
  4. //==================================
  5. #include <windows.h>
  6. #pragma hdrstop
  7. #include "w32srvdb.h"
  8.  
  9. typedef struct
  10. {
  11.     WORD    ah;
  12.     PSTR    pszName;
  13. } INT21_FUNCTION_ID, *PINT21_FUNCTION_ID;
  14.  
  15. INT21_FUNCTION_ID Int21Functions[] = {
  16. { 0x00, "terminate Program" },
  17. { 0x01, "stdin input with echo" },
  18. { 0x02, "stdout output" },
  19. { 0x03, "stdaux input" },
  20. { 0x04, "stdaux output" },
  21. { 0x05, "printer output" },
  22. { 0x06, "direct console I/O" },
  23. { 0x07, "direct console input without echo" },
  24. { 0x08, "char input without echo" },
  25. { 0x09, "write string to stdout" },
  26. { 0x0A, "buffered keyb input" },
  27. { 0x0B, "get stdin status" },
  28. { 0x0C, "flush buffer" },
  29. { 0x0D, "disk reset" },
  30. { 0x0E, "set default drive" },
  31. { 0x0F, "open file using FCB" },
  32. { 0x10, "close file using FCB" },
  33. { 0x11, "find first using FCB" },
  34. { 0x12, "find next using FCB" },
  35. { 0x13, "delete file using FCB" },
  36. { 0x14, "read file using FCB" },
  37. { 0x15, "write file using FCB" },
  38. { 0x16, "create file using FCB" },
  39. { 0x17, "rename file using FCB" },
  40. { 0x18, "null CPM function" },
  41. { 0x19, "get current drive" },
  42. { 0x1A, "Set DTA" },
  43. { 0x1B, "get allocation info for default drive" },
  44. { 0x1C, "get allocation info for specified drive" },
  45. { 0x1D, "null CPM function" },
  46. { 0x1E, "null CPM function" },
  47. { 0x1F, "get drive parameter block" },
  48. { 0x20, "null CPM function" },
  49. { 0x21, "read random using FCB" },
  50. { 0x22, "write random using FCB" },
  51. { 0x23, "file size using FCB" },
  52. { 0x24, "set record number using FCB" },
  53. { 0x25, "set INT vector" },
  54. { 0x26, "create new PSP" },
  55. { 0x27, "random read using FCB" },
  56. { 0x28, "random write using FCB" },
  57. { 0x29, "parse filename using FCB" },
  58. { 0x2A, "get system date" },
  59. { 0x2B, "set system date" },
  60. { 0x2C, "get system time" },
  61. { 0x2D, "set system time" },
  62. { 0x2E, "set verify flag" },
  63. { 0x2F, "get DTA" },
  64. { 0x30, "get DOS version" },
  65. { 0x31, "terminate and stay resident" },
  66. { 0x32, "get DOS drive paramter block" },
  67. { 0x33, "break state" },
  68. { 0x34, "get INDOS flag" },
  69. { 0x35, "get INT vector" },
  70. { 0x36, "get disk free space" },
  71. { 0x37, "get/set switch char" },
  72. { 0x38, "get country info" },
  73. { 0x39, "create directory" },
  74. { 0x3A, "remove directory" },
  75. { 0x3B, "change directory" },
  76. { 0x3C, "create file" },
  77. { 0x3D, "open existing file" },
  78. { 0x3E, "close file" },
  79. { 0x3F, "read file" },
  80. { 0x40, "write file" },
  81. { 0x41, "delete file" },
  82. { 0x42, "set file position" },
  83. { 0x43, "get/set file attributes" },
  84. { 0x44, "IOCTL" },
  85. { 0x45, "dup file handle" },
  86. { 0x46, "force dup file handle" },
  87. { 0x47, "get current directory" },
  88. { 0x48, "allocate memory" },
  89. { 0x49, "free memory" },
  90. { 0x4A, "resize memory block" },
  91. { 0x4B, "EXEC" },
  92. { 0x4C, "exit process" },
  93. { 0x4D, "get return code" },
  94. { 0x4E, "find first file" },
  95. { 0x4F, "find next file" },
  96. { 0x50, "set current PSP" },
  97. { 0x51, "get current PSP" },
  98. { 0x52, "get list of lists" },
  99. { 0x53, "translate BIOS parameter block" },
  100. { 0x54, "get verify flat" },
  101. { 0x55, "create child PSP" },
  102. { 0x56, "rename file" },
  103. { 0x57, "get file date/time" },
  104. { 0x58, "get/set memory allocation strategy" },
  105. { 0x59, "get extended error info" },
  106. { 0x5A, "create temporary file" },
  107. { 0x5B, "create new file" },
  108. { 0x5C, "file locking" },
  109. { 0x5D, "rat's nest" },
  110. { 0x5E, "network functions" },
  111. { 0x5F, "enable/disable drive" },
  112. { 0x60, "get canonical filename" },
  113. { 0x61, "unused" },
  114. { 0x62, "get current PSP" },
  115. { 0x63, "get lead byte table address/other stuff" },
  116. { 0x64, "set device driver lookahead" },
  117. { 0x65, "get extended country info" },
  118. { 0x66, "get/set global page table" },
  119. { 0x67, "set handle count" },
  120. { 0x68, "commit file" },
  121. { 0x69, "get/set disk serial number" },
  122. { 0x6a, "commit file" },
  123. { 0x6b, "IFS IOCTL" },
  124. { 0x6C, "Extended open/create" },
  125. { 0x6D, "find first ROM program" },
  126. { 0x6E, "find next ROM program" },
  127. { 0x6F, "get/set ROM scan start address" },
  128. { 0x70, "unknown" },
  129. { 0x71, "LFN"    },
  130. };
  131.  
  132. #define NUM_DOS_FUNCTIONS (sizeof(Int21Functions)/sizeof(INT21_FUNCTION_ID))
  133.  
  134. BOOL
  135. GetWin32ServiceName(
  136.     DWORD id,
  137.     DWORD param1,
  138.     PSTR pszBuffer,
  139.     unsigned cbBuffer
  140. )
  141. {
  142.     PWIN32_SERVICE_CALL pW32Service;
  143.     
  144.     pW32Service = LookupWin32ServiceCall( id );
  145.     if ( !pW32Service )
  146.     {
  147.         wsprintf( pszBuffer, "%08X", id );
  148.         return TRUE;
  149.     }
  150.     
  151.     strcpy( pszBuffer, pW32Service->pszServiceName );
  152.  
  153.     if ( HIWORD(id) == 0x002A )
  154.     {
  155.         if ( LOWORD(id) == 0x10 )
  156.         {
  157.             BYTE ah_code = HIBYTE(LOWORD(param1));
  158.             BYTE al_code = LOBYTE(param1);
  159.  
  160.             if ( ah_code < NUM_DOS_FUNCTIONS )
  161.             {
  162.                 wsprintf( pszBuffer + lstrlen(pszBuffer), " %s",
  163.                             Int21Functions[ah_code].pszName );
  164.             }
  165.  
  166.             if ( ah_code == 0x71 )
  167.             {
  168.                 if ( al_code < NUM_DOS_FUNCTIONS )
  169.                 {
  170.                     wsprintf( pszBuffer + lstrlen(pszBuffer), " %s",
  171.                                 Int21Functions[al_code].pszName );
  172.                 }
  173.                 else
  174.                 {
  175.                     PSTR p;
  176.                     
  177.                     switch( al_code )
  178.                     {
  179.                         case 0xA0: p = "Get Volume Information"; break;
  180.                         case 0xA1: p = "Find Close"; break;
  181.                         case 0xA6: p = "Get File Info By Handle"; break;
  182.                         case 0xA7: p = "File Time To DOS Time"; break;
  183.                         default: p = 0;
  184.                     }
  185.                     
  186.                     if ( p )
  187.                         wsprintf( pszBuffer + lstrlen(pszBuffer), " %s", p );
  188.                 }
  189.             }
  190.         }
  191.     }
  192.  
  193.     return TRUE;
  194. }
  195.